home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / drawpe1a / rmmain.frm (.txt) < prev   
Visual Basic Form  |  1999-10-01  |  5KB  |  116 lines

  1. VERSION 5.00
  2. Begin VB.Form frmMain 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Draw Percent"
  5.    ClientHeight    =   1020
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   3045
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    ScaleHeight     =   1020
  12.    ScaleWidth      =   3045
  13.    StartUpPosition =   3  'Windows Default
  14.    Begin VB.CommandButton cmdDraw 
  15.       Caption         =   "Draw Percent"
  16.       Height          =   375
  17.       Left            =   840
  18.       TabIndex        =   1
  19.       Top             =   600
  20.       Width           =   1335
  21.    End
  22.    Begin VB.PictureBox picPercent 
  23.       Height          =   375
  24.       Left            =   0
  25.       ScaleHeight     =   315
  26.       ScaleWidth      =   2955
  27.       TabIndex        =   0
  28.       Top             =   0
  29.       Width           =   3015
  30.    End
  31.    Begin VB.Line lneSep 
  32.       BorderColor     =   &H8000000C&
  33.       Index           =   1
  34.       X1              =   0
  35.       X2              =   3000
  36.       Y1              =   470
  37.       Y2              =   470
  38.    End
  39.    Begin VB.Line lneSep 
  40.       BorderColor     =   &H00FFFFFF&
  41.       Index           =   0
  42.       X1              =   0
  43.       X2              =   3000
  44.       Y1              =   480
  45.       Y2              =   480
  46.    End
  47. Attribute VB_Name = "frmMain"
  48. Attribute VB_GlobalNameSpace = False
  49. Attribute VB_Creatable = False
  50. Attribute VB_PredeclaredId = True
  51. Attribute VB_Exposed = False
  52. '**********************************************************
  53. '*            Draw Percent by Joseph Huntley              *
  54. '*               joseph_huntley@email.com                 *
  55. '*                http://joseph.vr9.com                   *
  56. '*                                                        *
  57. '*  Made:  October 1, 1999                                *
  58. '*  Level: Beginner                                       *
  59. '**********************************************************
  60. '*   The form here are only used to demonstrate how to    *
  61. '* use the function 'DrawPercent'. You may copy the       *
  62. '* functions into your project for use. If you need any   *
  63. '* help please e-mail me.                                 *
  64. '**********************************************************
  65. '* Notes: The subroutine 'Pause' is not required for      *
  66. '*        use of the function 'DrawPercent'. It is only   *
  67. '*        used to slow down the progress so you can see   *
  68. '*        what this example does in detail.               *
  69. '**********************************************************
  70. Sub Pause(dblInterval As Double)
  71.  'NOTE: You do not need this function! It is only to
  72.  '      slow down the progress bar for the form.
  73.  Dim dblCurrent As Double
  74.  dblCurrent# = Timer
  75.    Do While Timer - dblCurrent# < dblInterval#
  76.      DoEvents
  77.    Loop
  78. End Sub
  79. Sub DrawPercent(picPic As Object, lngPercent As Long)
  80. '**********************************************************
  81. '*            Draw Percent by Joseph Huntley              *
  82. '*               joseph_huntley@email.com                 *
  83. '*                http://joseph.vr9.com                   *
  84. '**********************************************************
  85. '*   You may use this code freely as long as credit is    *
  86. '* given to the author, and the header remains intact.    *
  87. '**********************************************************
  88. '--------------------- The Arguments -----------------------
  89. 'picPic     - The object to draw on.
  90. 'lngPercent - The percentage to print out.
  91. '-----------------------------------------------------------
  92. 'Description: Draws a percentage bar on an object.
  93.   With picPic
  94.     .Cls
  95.     .ScaleMode = vbpixel
  96.     .DrawMode = vbNotXorPen
  97.     .BackColor = vbWhite 'Change for different background color
  98.     .ForeColor = vbBlue  'Change for different foreground color
  99.     .AutoRedraw = True
  100.     .CurrentX = .ScaleWidth / 2 - .TextWidth(CStr(lngPercent&) & "%") / 2
  101.     .CurrentY = .ScaleHeight / 2 - .TextHeight(CStr(lngPercent&) & "%") / 2
  102.     picPic.Print CStr(lngPercent&) & "%"
  103.     picPic.Line (1, 1)-((.Width / 100) * lngPercent&, .Height), vbBlue, BF
  104.     .Refresh
  105.   End With
  106. End Sub
  107. Private Sub cmdDraw_Click()
  108.    Dim lngCurPercent As Long
  109.      For lngCurPercent& = 1 To 100
  110.         Call DrawPercent(picPercent, lngCurPercent&)
  111.         Call Pause(0.001)
  112.      Next lngCurPercent&
  113. End Sub
  114. Private Sub Form_Load()
  115. End Sub
  116.